package com.menu;

import java.io.IOException;
import java.util.Scanner;

public class SelectServer {

    public void selectServer() throws IOException {

        boolean flag = true;
        while (flag) {

            System.out.println("\\n请选择存储的数据结构：\\n");
            System.out.println("\t1.用顺序表进行存储");
            System.out.println("\t2.用链表进行存储\\n");
            System.out.println("\t3.用平衡二叉树进行存储\\n");
            System.out.println("\t0.退出\\n");
            System.out.print("\t请选择：");


            int sc = -1;
            try{
                Scanner scanner = new Scanner(System.in);
                sc = scanner.nextInt();
            }catch (Exception e) {
                System.out.println("错误有误,请重新输入");
            }

            switch (sc) {
                case 1: {
                    ArrayServerMenu sm = new ArrayServerMenu();
                    sm.serverMenu();
                    break;
                }
                case 2: {
                    LinkServerMenu lsm = new LinkServerMenu();
                    lsm.linkServerMenu();
                    break;
                }
                case 3: {
                    TreeServerMenu tsm = new TreeServerMenu();
                    tsm.treeServerMenu();
                    break;
                }
                case 0: {
                    flag = false;
                    break;
                }
                default: {
                    System.out.println("输入有误，请重新输入：");
                    break;
                }
            }
        }


    }


}
